package com.ysy.tz.mfg.equipment.scale;

public class WeightValue {
    int sameCount = 2;
    private String value;
    private int currentCount = 0;

    public WeightValue() {
    }

    public void weightValue(int sameCount) {
        this.sameCount = sameCount;
    }

    public void setWeight(String weight) {
        if (this.value == null) {
            this.value = weight;
            this.currentCount = 1;
        } else if (this.value.equals(weight)) {
            ++this.currentCount;
            if (this.currentCount == this.sameCount) {
                System.out.println("取到数值--->>>" + this.value);
            } else if (this.currentCount > this.sameCount) {
                System.out.println("值未改变--->>>" + this.value);
            }
        } else {
            this.value = weight;
            this.currentCount = 1;
        }

    }

    public String getCurrentWeight() {
        return this.value;
    }

    public static void main(String[] argsp) {
        WeightValue weightValue = new WeightValue();
        weightValue.setWeight("65.25");
        weightValue.setWeight("65.25");
        weightValue.setWeight("65.25");
        weightValue.setWeight("35.25");
        weightValue.setWeight("12.25");
        weightValue.setWeight("12.25");
    }
}
